In [59]:
import requests
person_req = requests.get('http://api.openhluttaw.org/en/persons/e5029cbf865f48e1b2e6e65e08d6c64e')
person = person_req.json()['result']
print 'Name: ' + person['name']
print 'Birthdate: ' + person['birth_date']
print 'Gender: ' + person['gender'] + "\n"
print "Contacts:\n"
for contacts in person['contact_details']:
print contacts['label'] +": " + contacts['value']
print "\nPhoto URL: " + person['image']
In [64]:
#memberships
for member in person['memberships']:
print person['name'] + " is,"
on_behalf_req = requests.get('http://api.openhluttaw.org/en/organizations/'+ member['on_behalf_of_id'])
on_behalf_of = on_behalf_req.json()['result']['name'] + '\n'
print "Member of " + member['organization']['name'] + " as " + member['role'] + " on behalf of " + \
on_behalf_of
In [57]:
person_req = requests.get('http://api.openhluttaw.org/my/persons/e5029cbf865f48e1b2e6e65e08d6c64e')
person = person_req.json()['result']
print person['name']
print person['birth_date']
print person['gender']
print "Contacts:\n"
for contacts in person['contact_details']:
print contacts['value']
#memberships
for member in person['memberships']:
on_behalf_req = requests.get('http://api.openhluttaw.org/my/organizations/'+ member['on_behalf_of_id'])
on_behalf_of = on_behalf_req.json()['result']['name']
print "Member of " + member['organization']['name']